/*jslint browser: true, devel: true, bitwise: true, white: true, plusplus: true */
/*global $:true, define:true */

/**
 * @module Core
 */

define(function() {
"use strict";

function Class(constructor, definition) {
	var 
		ret = constructor, 
		base = definition.base;
	if (!constructor) {
		throw new Error("[Class] Undefined constructor, can't create class");
	} 
	
	if (definition.interfaces) {
		constructor.INTERFACES = definition.interfaces;
	}
		
	if (base) {
		constructor.SUPER = base;
		constructor.prototype = Object.create(base.prototype);
		constructor.prototype.$super = base.prototype;
			
		ret = constructor.prototype;
		ret.constructor = constructor;
			
	} else if (definition.methods) {
		constructor.prototype = definition.methods;
	} else {
		throw new Error("[Class] undefined methods can't create class");
	}
		
	if (definition.props) {
			Object.defineProperties(constructor.prototype,definition.props);
	}

	return ret;
}

return Class;

});
